<template>
  <div :class="['audit-flow', { 'school-scoped': userId != 1 }]">
    <div class="flow-left">
      <SchoolPermission @e-emit="schoolSelect" />
    </div>
    <div class="flow-right">
      <Search />
      <List v-if="scope" :scope="scope" />
      <Add v-if="scope" :scope="scope" />
    </div>
  </div>
</template>
<script>
import { mapGetters } from "vuex";
import Bus from "@/utils/bus.js";
export default {
  components: {
    SchoolPermission: () => import("@/components/schoolPermission/index.vue"),
    List: () => import("./List.vue"),
    Search: () => import("./Search.vue"),
    Add: () => import("./Add.vue"),
  },
  data() {
    return {
      scope: "",
      deptData: [],
    };
  },
  computed: mapGetters(["userId"]),
  methods: {
    schoolSelect(v) {
      let rou = this.$route.name;
      if (rou != "school-course") {
        this.$router.go(-1);
      }
      this.scope = v.id;
      Bus.$emit("refreshFlowList", { scope: v.id });
    },
  },
};
</script>
<style scoped lang="scss">
.audit-flow {
  position: relative;
  .flow-left {
    position: absolute;
    left: 0;
    top: 0;
    width: 240px;
    min-height: 500px;
  }
  .flow-right {
    position: absolute;
    left: 250px;
    right: 0;
    top: 0;
    min-height: 500px;
  }
}
.school-scoped {
  .flow-left {
    display: none;
  }
  .flow-right {
    left: 0;
  }
}
</style>